<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>

<script>
  function onSubmit(op,supplierId){
    	   document.getElementById('optioninfo').value=op;
    	   document.getElementById('supplier_id').value=supplierId;

      	var form = document.getElementById('userForm');
           form.action="supplierlist/"+op;
           form.submit();
      }

  function onSubmitDelete(op,supplierId){
    	   document.getElementById('optioninfo').value=op;
    	   document.getElementById('supplier_id').value=supplierId;
    	   if (false === confirm('削除しますか？') )return;

        var form = document.getElementById('userForm');
           form.action="supplierlist/"+op;
           form.submit();
      }

  function onSubmitCsv(op,supplierId){

    	   document.getElementById('optioninfo').value=op;
    	   document.getElementById('supplier_id').value=supplierId;

           var form = document.getElementById('userForm');
           form.action="supplier/"+op;
           form.submit();
	  }
  </script>

</head>

@extends('layouts.admin_common') @section('content')

<div class="breadcrumbs_container">
	{{Breadcrumbs::render('admin.supplier_master') }}</div>
<div class="system_tab_line"></div>

<body>
	<div id="outDiv">

		<table class="table table-condensed">
			<tr>
				<td>会社名</td>
				<td>会社名カナ</td>
				<td>ログインID</td>
				<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			</tr>
			<tr>@foreach ($supplierInfos as $supplierInfo)


			<tr>
				<td>{{$supplierInfo->supplier_name}}</td>
				<td>{{$supplierInfo->supplier_catelogue}}</td>
				<td>{{$supplierInfo->supplier_postcode}}</td>
				<td><input type="button" value="修正"
					class="btn btn-primary button_normal"
					onclick="onSubmit('create','{{$supplierInfo->supplier_id}}')" /><input
					type="button" value="削除" class="btn btn-primary button_normal"
					onclick="onSubmitDelete('delete','{{$supplierInfo->supplier_id}}')" /></td>
			</tr>
			@endforeach
		</table>
		<form class="form-inline" id="userForm" method="post"
			enctype="multipart/form-data">

			<table border="0" cellspacing="0" style="width: 1300px;">
				<tr>
					<td align="right" style="width: 660px;"><input type="button"
						value="新規" class="pure-button pure-button-primary button_normal"
						onclick="onSubmit('create','')" /></td>
					<td align="right" style="width: 10px;"><label for="sample1"
						class="btn btn-primary button_normal">Csv取込 <input type="file"
							name="csv_file" id="sample1" style="display: none;"
							class="btn btn-primary button_normal"
							onChange="onSubmitCsv('csv','{{$supplierInfo->supplier_id}}')" />
					</label></td>
				</tr>
			</table>
			<div>@if(isset($success)) {{$success}} @endif</div>
			<div>@if(isset($error)) {{$error}} @endif</div>
			<input type="hidden" id="supplier_id" name="supplier_id"> <input
				type="hidden" id="optioninfo" name="optioninfo"> <input
				type="hidden" name="_token" value="{{csrf_token()}}">
		</form>
	</div>
</body>
</html>
@endsection
